home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_actor_hyena.cog < prev    next >
Text File  |  1999-11-15  |  2KB  |  86 lines

  1. # Jones 3D Cog Script
  2. #
  3. # actor_Hyena.cog
  4. #
  5. # [MDR]
  6. #
  7. # Special behavior for the Hyena.
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ========================================================================================
  12.  
  13. symbols
  14.  
  15.     message        created
  16.     message        damaged
  17.     message        timer
  18.    
  19. int            timerID                        local
  20. thing        hyena                        local
  21.  
  22. int            TIMER_ID_WAKEUP_AND_DIE=0    local
  23.  
  24. end
  25.  
  26. # ========================================================================================
  27. code
  28.  
  29. # .................................................................................    
  30. created:
  31.  
  32.     AISetSubMode(GetSenderRef(), 0x100000);        # Set SUBMODE_USEMATCHVELOCITY
  33.     AISetSubMode(GetSenderRef(), 0x20000);        # Set SUBMODE_SEMICONTINUOUSMOTION
  34.  
  35.     return;
  36.  
  37. # .................................................................................    
  38. damaged:
  39.     // If not a fatal blow, then flee
  40.     if ( (GetParam(0) < GetHealth(GetSenderRef()))
  41.          && (RandBetween(1, 100) < 50)
  42.          )
  43.     {
  44.         AIFlee(GetSenderRef(), GetThingParent(GetSourceRef()));
  45.     }
  46.     # Jeep or MineCar hit us
  47.     else if (GetParam(1) == 0x02000000)
  48.     {
  49.         # If invulnerable or immobile, ignore -- avoids multiple collision problem
  50.         if (BitTest(GetActorFlags(GetSenderRef()), 0x40008))
  51.         { 
  52. #            DebugPrint("Ignore damage, because invulnerable");
  53.             ReturnEx(0);
  54.             return;
  55.         }
  56.         else if (GetParam(0) >= GetThingHealth(GetSenderRef()))
  57.         {
  58. #            DebugPrint("Runover and kill");
  59.             // long enough to land
  60.             AIRunOver(GetSenderRef(), RandBetween(5, 6), TIMER_ID_WAKEUP_AND_DIE);
  61.             ReturnEx(0);
  62.             return;
  63.         }
  64.     }
  65.     return;
  66.  
  67. # -------------------------------------------------------------------
  68.  
  69. timer:
  70.     hyena = GetParam(0);
  71.     timerID = GetSenderId();
  72. #    DebugFlex(timerID, "timer ID");
  73.  
  74.     if (timerID == TIMER_ID_WAKEUP_AND_DIE)
  75.     {
  76.         ClearActorFlags(hyena, 0x8); // make sure not invulnerable
  77.         DamageThing(hyena, GetThingMaxHealth(hyena), 0x1, GetLocalPlayerThing()); // using impact damage to avoid infinite loop
  78.     }
  79.  
  80.     return;
  81.  
  82.  
  83.  
  84. end
  85.  
  86.